﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CreativeModel.FactoryMethod.Question
{
    public abstract class Cross_Platform_DialogBox{
        public abstract IButton  CreateButton();

        public string CreatBox() { 
            var box = CreateButton();

            return "CreateBox" + $"{box.CreatButton()}";
        }
    }

    public class WindowsDialogBoxCreator : Cross_Platform_DialogBox{
        public override IButton CreateButton(){
            return new WindowsButton();
        }
    }

    public class MacOSDialogBoxCreator : Cross_Platform_DialogBox {
        public override IButton CreateButton(){
            return new MacOSButton();
        }
    }

    public class LinuxDialogBoxCreator : Cross_Platform_DialogBox{
        public override IButton CreateButton(){
            return new LinuxButton();
        }
    }

    public interface IButton {
        string CreatButton();
    }

    public class WindowsButton : IButton{
        public  string CreatButton(){
            return "{Windows_Button !}";
        }
    }

    public class MacOSButton : IButton {
        public string CreatButton() {
            return "{MacOS_Button !}";
        }
    }

    public class LinuxButton : IButton {
        public string CreatButton() {
            return "{Linux_Button !}";
        }
    }

    public class CPDialogBox_Client {
        public void Main() {
            Render(new WindowsDialogBoxCreator());
            Console.WriteLine("");
            Render(new MacOSDialogBoxCreator());
            Console.WriteLine("");
            Render(new LinuxDialogBoxCreator());
        }
        public void Render(Cross_Platform_DialogBox cpdb) {
            Console.WriteLine(cpdb.CreatBox());
        }
    }

}
